from django.http import HttpResponse
from rest_framework.utils import json


def response_success(data = {},msg = '操作成功！',success=True):
    response = {
        'success': success,
        'data': data,
        'msg': msg,
    }
    return HttpResponse(json.dumps(response,ensure_ascii=False))

def response_fails(msg = '操作失败！',success=False):
    response = {
        'success': success,
        'msg': msg,
    }
    return HttpResponse(json.dumps(response,ensure_ascii=False))